package com.ruoyi.common.utils.http;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 描述 标准HTTP响应实现类
 * 作者 ZhangPing
 * 创建时间 2023/9/5 19:47
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class CommonResponse<T> implements BaseResponse<T>{

    private Integer code;
    private String msg;
    private T data;

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public T getData() {
        return data;
    }

    @Override
    public boolean isSuccess() {
        return getCode() == 200 || getCode() == 0;
    }
}
